Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

[reverted] fix canvas drawLine bugs#38753

Merged
alanwutang11 merged 3 commits intoflutter:mainfrom
alanwutang11:drawLine-with-negative-offset
Jan 12, 2023
Merged

[reverted] fix canvas drawLine bugs#38753
alanwutang11 merged 3 commits intoflutter:mainfrom
alanwutang11:drawLine-with-negative-offset

Conversation

@alanwutang11
Copy link
Copy Markdown
Contributor

@alanwutang11 alanwutang11 commented Jan 10, 2023

edit: this PR was reverted

There were several bugs with canvas.drawLine when using DOM rendering (this codepath):

  • did not correctly render with negative ui.Offsets passed as parameters
  • did not respect paint.strokeCap
  • did not respect paint.strokeWidth for horizontal and vertical lines

according to the api docs for canvas.drawLine, rendering of lines should be the same regardless of the paint.style.

Previously, however, failing to set paint.style to type stroke (either by omission or setting the paint.style to fill) would cause us to use DOM rendering as specified by this bool, which introduced the above mentioned bugs.

Solution for negative ui.Offsets

instead of using an svg width, height, and viewBox as the bounding box for our path, just remove all of those properties and instead set the svg overflow property to visible.

fixes: flutter/flutter#110070

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test-exempt. See testing the engine for instructions on writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the CLA.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Loading
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

platform-web Code specifically for the web engine will affect goldens

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Problem with Stack -> "ImageAsset + CustomPainter" with web-renderer html

3 participants